<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    let name = ["ming", 'tan', 'zhao', 'qian', 'qian', 'zhao']
    let data = new Set(name)//自动去除重复
    console.log(data.size);//长度
    console.log(data.add('sun'));//增
    console.log(data.delete('sun'));//删
    data.clear(0)//清空
    console.log(data);
    for (let s of data) {//遍历数组的值
      console.log(s);
    }
    //数组去重
    let name2 = ['zhao', 'wu', 'wu', 'zheng', 'wang', 'zhou']
    let data2 = new Set(name2)
    console.log([...data2]);
    //求并集
    //求差集
    //求交集(先去重，后用filter来遍历，has判断字符串是否存在此数组中)
  </script>
</body>

</html>